/**
 * @ClassName LC263
 * 丑数
 * @Author ykx
 * @Date 2024/3/10 16:02
 * @Version 1.0
 */
public class LC263 {
    public static void main(String[] args) {
        LC263 lc263 = new LC263();
        System.out.println(lc263.isUgly(-2147483648));
    }

    public boolean isUgly(int n) {
        if (n < 0) {
            return false;
        }

        if (n == 1) {
            return true;
        } else if (n % 2 == 0) {
            return isUgly(n / 2);
        } else if (n % 3 == 0) {
            return isUgly(n / 3);
        } else if (n % 5 == 0) {
            return isUgly(n / 5);
        } else {
            return false;
        }
    }
}
